from django.contrib import admin
from order.models import Userinfo,Dish,Package,Order
from django import forms
from django.core.urlresolvers import reverse

class UserinfoAdmin(admin.ModelAdmin):
    list_display = ('name', 'mobile', 'address', 'note', )
    list_filter = ['address', ]
    search_fields = ['name', 'address', 'mobile']
    #filter_horizontal = ('rel_biz',)

class DishAdmin(admin.ModelAdmin):
    list_display = ('name', 'cooktype', 'type', 'prefer', 'price')
    list_filter = ['cooktype', 'type','prefer' ]
    search_fields = ['name', 'material', 'detail']

class PackageAdmin(admin.ModelAdmin):
    list_display = ('name', 'date_deal', 'meal_type', 'price')
    list_filter = ['date_deal', 'meal_type']
    search_field = ['name']
    filter_horizontal = ('content',)

class OrderAdmin(admin.ModelAdmin):
    list_display = ('user', 'remark', 'expect', 'status')
    list_filter = ['status']
    search_field = ['remark']
    filter_horizontal = ('cart',)
    
admin.site.register(Userinfo, UserinfoAdmin)
admin.site.register(Dish, DishAdmin)
admin.site.register(Package, PackageAdmin)
admin.site.register(Order, OrderAdmin)

